﻿package com.etc.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091900549179";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCSTUaa/+lZHnEM7Y0tH0A2WLfg4tb3B7PoKdx1Ud7jxJBgen1R0mloLBgK+DIpRMioQC50q/KYpgsKMHeY72GFuYMY9VLMB7lndDfXEDz7pKyiguahBOMuBm15DGaI3rm4JYVnM/Q+tfkTHfvB2u7mCLLzsYMyZ99FFn+2Qq16vhxpDgvGIijsGxT+gaW54jwqIdoa9EKNsTXog+qOtUFEJkq/f3rF3VVFJf/eOCiYnDAiD08ddQf+nx/nOmOC1HR0/afxPqfYCUjz7MCysdUufn+FuKlBAClO7KbQGEGrL/YxVUTDxXcRllDiC/IT0OlcKgJwyhpXSN8z1iZ90BWLAgMBAAECggEAODunldAjevOudE+iYeOPJNR46OGHyq+VQPlGGXn8eAOHku3B2X9MsJOyMhUwApjDn5f7wzCMMIwx1hrG/WuVSncBosg4qN+XLeKHzAwbxIWJLXWu+9kLERe7YDmZ96XUMKmLWx2nFauQLv7pU5u5E4Xocq6aRPeT49RABmgekfyFj8dwW+HhLGwMMUoSfms3IYGAgwbhOfHvK5XLuySVOneY5XcEiM7eP5x2/S/5V+FkWodKD1q4vOXTL1/qHzq1q05GhsmD5N1LWXL5ppQ6RIHZ+cp46/Yz3zSs4efCkUqbivhQNiX8tTct06QQmjd0gERjh5grhZqsC4r0rLMmgQKBgQDmtBRYdKLiCAtwdZdGNiITxkEqnaGdPbgoQhsWSoCtoNSM7uSQ/pHkk0lb6lvm22jqPZ2R8MRP7x2K4Kw2vBM3seJ0ldU51DVi/hmXteX5S1ZooNs/Q5Z3bZ3geM65jo7cblJFdAfFAM2q335Dg6XCb4DK5VMfQiCVorou/GJZawKBgQCiWAQ/fXV4IvTJVK0dOmYUYeuE0iW+fMIu8rjWXujxEFETwr52aZ7TOmGVZy144jnV9eMhDDPBuBSTU46/x3+Y22AgTR9gfp9ayKiBh66PrfFzEusBKq/MnTtiIVY1wy9e7w7/aI5zScHjyo7G6Qf7SdL87Rdg5T+F5Awr8u2cYQKBgB4upRLFf6HOp6B44eefoWmw4EmxAbnOn081BtItwRP2HJirkF+fznp3Anvx90AGqH0svnafZy+F+vl2V1F53ZHFxfi2uYStTKa806BTfdjVkGJz2Ps33nGVd7gsVe9UxT/1dvH7MiEF7+JRBvXSPVdouxLQWcWXIygwd+c5wawtAoGAUwBTM67ON10P8DuVwsLP3A3wX1keKRUaJuy8KgYebNmdyk+gF2SK6o4HxF4bNpnbXhQ4SvY1JA8cnfJzooO6LgnDTOCBcVFr4fuDg64+RoF1WBNNCayscx3Udah7rkMb3hq1fUoUwsbsFa3Db9lG1mh5Mg16DXVIFAlzW6j5aSECgYBHXQTg0cdarkDU7TKZzYyxH5h0At0ROqb9v/xxkS9p4miwrYev4VsWJqk0nYD/vhigVrMztjMg9VcKAcqGwz0+7psTiTY7hYG+tacV046PxxFiw92Bao5Qr/SIc0Kl7a2+zvMkGIkHSq71phSFsqMXvcix+x+NUxzkUETlh01wew==";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuIKqRmhrQRMuP2ahfpqB5MFB8ZIbWNWA516Q3Szva4xdDAH2wJl6D4r3L4OGtGjd8tvItG90iyjnh+Ph8oXnSOlMEg+70Q1tAa8qZ51VobuFvg2EHy/Pixg7rTeUB+Df0/rrfKBJZMUSN+y93BpEwENJr8GRr0DaUQ3g9Ejfr1agq9DRc1A8sm8NK2X6g1C75Juc0mH4j+ygXX7OGY4TpgJP9X4csCPc420Yd43amA0dPrtDp8bATwktDYW4YMhYlr8S3quFi4mM24g2NYJFnkeAbxeRRQSd3eZ7+iMjj8dx/27EyKeG5TfCovWVhY0fAt2trWjQDd4WlMFORo+4QQIDAQAB";
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/JIKE/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/JIKE/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

